<?php
/**
 * Desc:
 * User: yangyang
 * Date: 2024/4/8 15:33
 * Ver: 1.0
 */

namespace App\Transformers;

use App\Models\Slider;
use League\Fractal\TransformerAbstract;

class SliderTransformer extends TransformerAbstract
{
    public function transform(Slider $slider)
    {
        return [
            'id'         => $slider->id,
            'title'      => $slider->title,
            'url'        => $slider->url,
            'img'        => $slider->img,
            'img_url'    => qiniu_url($slider->img),
            'seq'        => $slider->seq,
            'status'     => $slider->status,
            'created_at' => $slider->created_at->toDateTimeString(),
            'updated_at' => $slider->updated_at->toDateTimeString(),
        ];
    }
}
